<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>LinkedChat招聘网</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/css/Information.css">
    <script src="${pageContext.request.contextPath}/public/static/js/jquery-3.6.0.min.js"></script>
    <script src="${pageContext.request.contextPath}/public/static/layui/layui.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/layui/css/layui.css">
    <link href="${pageContext.request.contextPath}/public/static/images/login_icon.ico" rel="shortcut icon">
</head>
<body>
<div class="resume-content">
<!--==================编辑个人信息====================-->
    <div class="item-primary">
        <div class="info-flex-item">
            <h4 class="name">
                编辑个人信息
            </h4>
            <form action="">
                <div class="form-item-required">
                    <div class="item-label">姓名</div>
                    <input type="text" class="personName" value="">
                </div>
                <div class="form-item7">
                    <div class="item-label">年龄</div>
                    <input type="text" class="personAge" value="">
                </div>
                <div class="form-item2">
                    <div class="item-label">性别</div>
                    <input type="text" class="personGender" value="">
                </div>
                <div class="form-item3">
                    <div class="item-label">生日</div>
                    <input type="date" class="personBirthday" value="">
                </div>
                <div class="form-item4">
                    <div class="item-label">用户名</div>
                    <input type="text" class="personUsername" value="">
                </div>
                <div class="form-item8">
                    <div class="item-label">密码</div>
                    <input type="text" class="personPassword"  value="">
                </div>
                <div class="form-item5">
                    <div class="item-label">电话</div>
                    <input type="tel" class="personTel" value="">
                </div>
                <div class="form-item6">
                    <div class="item-label">状态</div>
                    <input type="text" class="personJobStatus" value="">
                </div>
                <div class="btn-primary1">
                    <input type="button" id="from-btn" value="确定">
                </div>
            </form>
        </div>
    </div>
</div>

</body>
<script>
    var personName = sessionStorage.getItem("personName")
    var personAge = sessionStorage.getItem("personAge")
    var personGender = sessionStorage.getItem("personGender")
    var personBirthday = sessionStorage.getItem("personBirthday")
    var personUsername = sessionStorage.getItem("personUsername")
    var personPassword = sessionStorage.getItem("personPassword")
    var personTel = sessionStorage.getItem("personTel")
    var personJobStatus = sessionStorage.getItem("personJobStatus")
    console.log("ppppppppppppppppppppp"+personName)
    console.log("ppppppppppppppppppppp"+personAge)
    console.log("ppppppppppppppppppppp"+personGender)
    $(".personName").val(personName)
    $(".personAge").val(personAge)
    $(".personGender").val(personGender)
    $(".personBirthday").val(personBirthday)
    $(".personUsername").val(personUsername)
    //$(".personPassword").val(personPassword)
    $(".personTel").val(personTel)
    $(".personJobStatus").val(personJobStatus)

    Information();
    function Information(){
        var token =localStorage.getItem("token");

        // var personTel =sessionStorage.getItem("personTel")
        // var personName =sessionStorage.getItem("personName")
        // console.log(personTel)
        // $("#personTel").val(personTel)
        // $("#personName").val(personName)
        <%--$.ajax({--%>
        <%--    type:"post",--%>
        <%--    url:"${pageContext.request.contextPath}/updatePerson", //与IndexController的 testIndex方法实现前后端数据交互--%>
        <%--    headers:{"token":token},--%>
        <%--    data:{token:token,}--%>
        <%--})--%>
        <%--console.log("获取的token值："+token)--%>

        $("#from-btn").click(function (){
            var personName =$(".personName").val();
            var personAge =$(".personAge").val();
            var personGender =$(".personGender").val();
            var personBirthday =$(".personBirthday").val();
            var personUsername =$(".personUsername").val();
            var personPassword =$(".personPassword").val();
            var personTel =$(".personTel").val();
            var personJobStatus =$(".personJobStatus").val();
            var token=localStorage.getItem("token")
            console.log("============================================"+token)
            console.log(personName);
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/updatePerson", //与IndexController的 testIndex方法实现前后端数据交互
                headers:{"token":token},
                data:{
                    token:token,
                    personName:personName,
                    personAge:personAge,
                    personGender:personGender,
                    personBirthday:personBirthday,
                    personUsername:personUsername,
                    personPassword:personPassword,
                    personTel:personTel,
                    personJobStatus:personJobStatus
                },
                success:function (result) {
                    var datas =result.data;
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                    parent.location.reload();
                }
            })
        })
    }

</script>
</html>